package com.ss.android.article.base.app;

import com.bytedance.article.b.JsonTransformer;
import com.google.gson.Gson;
import com.google.gson.internal.Primitives;

import java.lang.reflect.Type;

public class GsonTransformer implements JsonTransformer {
    private static final Gson gson = new Gson();

    public GsonTransformer() {

    }

    public final <T> T fromJson(String json, Class<T> clazz) {
        return Primitives.wrap(clazz).cast(gson.fromJson(json, ((Type) clazz)));
    }
}

